﻿using System;
using System.Collections.Generic;
using System.Text;

namespace hedefgrup.reports.common
{
    public class Criteria_Network : Criteria
    {
        public const string AllNetworks = "Türkiye Geneli";
        public const string Network1 = "Şebeke 1: YS / Uydu Kümüle";
        public const string Network2 = "Şebeke 2: Bağlı Noktalar";
        public const string Network3 = "Şebeke 3: YS / Uydu Detay";
        public const string RStore = "R-Store";

        private static readonly List<string> allNetworks = new List<string>(new string[] { AllNetworks, Network1, Network2, Network3, RStore });

        public Criteria_Network()
        {
            Values.Add(AllNetworks);
        }

        public override string Name
        {
            get
            {
                return "Network";
            }
        }

        public override string[] GetValueList()
        {
            return allNetworks.ToArray();
        }

        public override object[] ToActualValues()
        {
            if (Value == AllNetworks)
            {
                return new object[] { null };
            }
            else if (Value == Network2)
            {
                return new object[] { true };
            }
            else
            {
                throw new NotImplementedException();
            }
        }

        public override object ToSqlStatementValue()
        {
            if (Value == Network2)
            {
                return true;
            }
            else
            {
                return 1;
            }
        }

        public override string Expression
        {
            get
            {
                if (Value == AllNetworks)
                {
                    return "1";
                }
                else if (Value == RStore)
                {
                    return "R_STORE";
                }
                else
                {
                    return "BAGLINOKTA";
                }
            }
        }

        public override string Operator
        {
            get
            {
                switch (Value)
                {
                    case AllNetworks:
                    case Network2:
                    case RStore:
                        return "=";
                    default:
                        return "IS NULL AND 1 =";
                }
            }
        }

        public override Type ValueType
        {
            get { return typeof(Boolean); }
        }
    }
}
